#打开文件
f=open("C:\\Users\\W\\Desktop\\未知\\python测试.txt",mode='r',encoding='GBK')
#读取文件
txt=f.read()
#编辑
linse=txt.split()
print(type(linse))
for i in linse:
    print(i)
#关闭文件
f.close()

f=open(r"C:\Users\W\Desktop\未知\python测试.txt",mode='r',encoding='GBK')
txt=f.read()
linse=txt.split()
print(type(linse))
for i in linse:
    print(i)
f.close()



#写入文件
fw=open("C:\\Users\\W\\Desktop\\未知\\python测试.txt",mode='w',encoding='GBK')
for i in range(1,10,1):
    fw.write("第{}行\r".format(i))
fw.close()

import json
f=open(r"C:\Users\W\Desktop\未知\json测试.json",mode='r',encoding='utf-8')
ftext=f.read()
f.close()
myjson=json.loads(ftext)
print(ftext)

for i in myjson['students']:
    print(i["studentInfo"]["name"])
    print(i["classInfo"]["grade"])